﻿function getOutboxFolder(fileSystemObject)
{
    return getFolder(fileSystemObject, 'data\\outbox');
}

function getSentFolder(fileSystemObject)
{
    return getFolder(fileSystemObject, 'data\\sent');
}

function getFolder(fileSystemObject, folderName)
{
    var runtimeFolderName = fileSystemObject.GetParentFolderName(window.location.pathname).replace(/%20/g, ' ');
    if(runtimeFolderName.charAt(0) == '/')
    {
        runtimeFolderName = runtimeFolderName.substr(1);
    }
    return fileSystemObject.GetFolder(runtimeFolderName + '\\' + folderName);
}

function getSurveyServerUrl()
{
    return 'http://localhost:1182/FormsServer/Feeds/SaveSurvey.aspx';
}

function getSurveyVersion()
{
    return '1.4';
}

function ExecuteForEach(collection, action)
{
    for(var enumerator = new Enumerator(collection); !enumerator.atEnd(); enumerator.moveNext())
    {
        action(enumerator.item());
    }
}